import numpy as np
from modelClass import Model,solModel



def myCost(x,model):

    print(x)
    v=model.v;
    w=model.w;
    W=model.W;

    V1=sum(v*x)
    W1=sum(w*x)
    V0=sum(v*(1-x))
    W0=sum(w*(1-x))
    print(W1/W)
    
    Violation=max(W1/W-1)
    z=V0*(1+100*Violation)

    sol = solModel(V1,W1,V0,W0,Violation,z,Violation == 0)

    return sol